## Sipeed MaiX Bit K210 YOLOv2 Learning
-----
### Environment
```
git clone https://notabug.org/luvres/sipeed-yolo2.git

cd sipeed-yolo2

# [ insert classes and annotations into each directory in images ]

images
├── annotations_train
│   ├── img1.xml
│   ├── img2.xml
│   └── img3.xml
├── annotations_valid
│   ├── img4.xml
│   └── img5.xml
├── images_train
│   ├── img1.jpg
│   ├── img2.jpg
│   └── img3.jpg
└── images_valid
    ├── img4.jpg
    └── img5.jpg

# [ or change the path of your own structure in cfg/train.json ]

# The images racoon dataset is included as an example 

# Change the dataset to your own example as well as the lables names in cfg / train.json 
```
```
docker run --rm --name OpenCV \
--publish=8888:8888 \
--mount type=bind,src=$PWD,dst=/root/noteboots \
--workdir=/root/noteboots \
-ti izone/yolo:cuda-opencv \
jupyter notebook \
        --allow-root \
        --no-browser \
        --ip=0.0.0.0 \
        --port=8888 \
        --notebook-dir=/root/noteboots \
        --NotebookApp.token=''
```
```
http://localhost:8888/
```

### And run SetUP.ipynb
```
# Install dependencies
!pip install tensorflow==1.15 keras imgaug
!bash get_nncase.sh

# Train model with exit my_model.h5
!python train.py -c cfg/train.json

# Convert .tflite to .kmodel (K210 format)
!bash tflite2kmodel.sh model.tflite
```

### LabelImg
```
sudo apt-get install pyqt5-dev-tools
sudo pip3 install -r requirements/requirements-linux-python3.txt
make qt5py3
python3 labelImg.py
python3 labelImg.py [IMAGE_PATH] [PRE-DEFINED CLASS FILE]

python3 $HOME/YOLO/labelImg/labelImg.py
```
-----
### References
```
# https://www.instructables.com/id/Object-Detection-With-Sipeed-MaiX-BoardsKendryte-K/

# https://courses.cs.washington.edu/courses/cse475/19au/labs/yolo2_tutorial.html

# https://github.com/experiencor/raccoon_dataset
```
